﻿#include "SetPrefixCommand.h"
#include "../CommandsManager.h"
#include "../../../Memory/GameData.h"


bool SetPrefixCommand_onExecute(const fast_io::vector<std::u8string>& args) {
	if (args.size() != 2) 
		return false;

	const std::u8string& prefix = args[1];

	if (prefix.size() != 1)
		return false;

	CommandMgr::prefix = prefix.front();

	switch (SettingManager::languageget) {
	case 0:
	default:
		C_GuiData::displayClientMessageC(Utils::TextColor::LIGHT_PURPLE,
										 u8"[Helium] ",
										 Utils::TextColor::GREEN,
										 u8"Successfully! ",
										 Utils::TextColor::BLUE,
										 u8"Your prefix is now: ",
										 Utils::TextColor::YELLOW,
										 fast_io::mnp::chvw(CommandMgr::prefix));
		break;
	case 1:
		C_GuiData::displayClientMessageC(Utils::TextColor::LIGHT_PURPLE,
										 u8"[Helium] ",
										 Utils::TextColor::GREEN,
										 u8"修改成功! ",
										 Utils::TextColor::BLUE,
										 u8"命令前缀现在是: ",
										 Utils::TextColor::YELLOW,
										 fast_io::mnp::chvw(CommandMgr::prefix));
		break;
	case 2:
		C_GuiData::displayClientMessageC(Utils::TextColor::LIGHT_PURPLE,
										 u8"[Helium] ",
										 Utils::TextColor::GREEN,
										 u8"修改成功! ",
										 Utils::TextColor::BLUE,
										 u8"命令前綴現在是: ",
										 Utils::TextColor::YELLOW,
										 fast_io::mnp::chvw(CommandMgr::prefix));
		break;
	case 3:
		C_GuiData::displayClientMessageC(Utils::TextColor::LIGHT_PURPLE,
										 u8"[Helium] ",
										 Utils::TextColor::GREEN,
										 u8"変更は成功しました! ",
										 Utils::TextColor::BLUE,
										 u8"コマンドプレフィックスが ",
										 Utils::TextColor::YELLOW,
										 fast_io::mnp::chvw(CommandMgr::prefix),
										 Utils::TextColor::BLUE,
										 u8" になりました");
		break;
		std::unreachable();
	}
	return true;
}

ICommand SetPrefixCommand{
	u8"setprefix",
	u8".setprefix/prefix <prefix>",
	{u8"Set the prefix for Heilum commands", u8"设置Helium命令前缀", u8"設定Heilum命令的首碼", u8"Heilumコマンドの接頭辞の設定"},
	{u8"prefix"},
	fast_io::vector<aliasList_struct>{},  // If empty must use fast_io::vector<aliasList_struct>{}
	nullptr,
	&SetPrefixCommand_onExecute };

